using System;
using SimpleServiceBus.Bus.MessageManagement;
using SimpleServiceBus.Bus.MessageManagement.MessageHandling;
using SimpleServiceBus.Bus.Pipeline;
using SimpleServiceBus.Bus.Pipeline.PipelineComponents.MessageFiltering;
using SimpleServiceBus.Endpoint;
using SimpleServiceBus.Endpoint.Management;
using SimpleServiceBus.Endpoint.Management.Monitoring;
using SimpleServiceBus.Endpoint.Management.Monitoring.Profiling;
using SimpleServiceBus.Endpoint.Metadata;
using SimpleServiceBus.Utilities.ObjectBuilder;

namespace SimpleServiceBus.Configuration
{
    public interface IEndpointBuilder
    {
        bool IsBuilt { get; }

        IMessagingEndpoint Endpoint { get; }
        EndpointDescription Metadata { get; }
        IObjectBuilderService Factory { get; }
        IMessageTypeManagementService MessageTypes { get; }
        IMessageHandlerContainer MessageHandlers { get; }
        IMessageFilterService MessageFilters { get; }
        void BuildEndpoint(IMessagingEndpoint endpoint);

        IEndpointManagementClientService ConfigureEndpointManager(string monitorServiceAddress,
                                                                         TimeSpan statusReportInterval,
                                                                         TimeSpan statusReportGracePeriod,
                                                                  params IEndpointStatusProbe[] statusProbes);

        IEndpointProfilerService ConfigureProfiler(bool enabled, bool profilePipelineComponents,PipelineDirection pipelineDirection);
        

        IMessagingEndpoint CreateEndpoint();

        IMessagingEndpoint CreateEndpoint(IObjectBuilder ioc);

        TServiceType GetService<TServiceType>()
            where TServiceType : class;

        TServiceType RegisterService<TServiceType, TDefaultImplementation>()
            where TServiceType : class
            where TDefaultImplementation : class, TServiceType;

        TServiceType RegisterService<TServiceType>(TServiceType serviceImplementation) where TServiceType : class;
    }
}